<template>
	<view>
		<uv-button text="一键授权登陆" :loading="loading" @click="onTestLoginWx"></uv-button>

		<uv-button text="测试Axios" :loading="loading" @click="onTestAxios"></uv-button>
	</view>
</template>

<script lang="ts" setup>
	import { ref } from "vue";
	import useAppStore from "@/store/app"
	import { captcha } from "@/api"

	const appSto = useAppStore()

	var loading = ref(false)

	async function onTestLoginWx() {
		try {
			loading.value = true
			await appSto.loginWx()
			loading.value = false
		} catch (error) {
			//TODO handle the exception
			loading.value = false
		}
	}

	async function onTestAxios() {
		try {
			loading.value = true
			await captcha()
			loading.value = false
		} catch (error) {
			//TODO handle the exception
			loading.value = false
			console.log(error)
		}
	}
</script>

<style>

</style>